package model2;

/**
 * Title：
 * Description：
 * Created by Myth on 5/15/2017.
 */
public class User {
    private String name;
    private String username;
    private String password;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    //查询数据库中是否存在该用户
    public boolean check() {
        String dbUsername = "123";  //假设数据库中的username是"123"
        String dbPassword = "pswd"; //假设数据库中的username是"pswd"
        if (dbUsername.equals(this.username)&&dbPassword.equals(this.password)) {
            this.name = "蔡鹏博";
            return true;  //存在该用户
        } else {
            return false; //不存在该用户
        }
    }
}
